package com.ruoyi.driver.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.system.api.model.LoginDriver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.driver.mapper.VehicleDriverMapper;
import com.ruoyi.driver.domain.VehicleDriver;
import com.ruoyi.driver.service.IVehicleDriverService;

/**
 * 司机管理Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-06-26
 */
@Service
public class VehicleDriverServiceImpl implements IVehicleDriverService 
{
    @Autowired
    private VehicleDriverMapper vehicleDriverMapper;

    /**
     * 查询司机管理
     * 
     * @param id 司机管理主键
     * @return 司机管理
     */
    @Override
    public VehicleDriver selectVehicleDriverById(Long id)
    {
        return vehicleDriverMapper.selectVehicleDriverById(id);
    }

    /**
     * 查询司机管理列表
     * 
     * @param vehicleDriver 司机管理
     * @return 司机管理
     */
    @Override
    public List<VehicleDriver> selectVehicleDriverList(VehicleDriver vehicleDriver)
    {
        return vehicleDriverMapper.selectVehicleDriverList(vehicleDriver);
    }

    /**
     * 新增司机管理
     * 
     * @param vehicleDriver 司机管理
     * @return 结果
     */
    @Override
    public int insertVehicleDriver(VehicleDriver vehicleDriver)
    {
        vehicleDriver.setCreateTime(DateUtils.getNowDate());
        return vehicleDriverMapper.insertVehicleDriver(vehicleDriver);
    }

    /**
     * 修改司机管理
     * 
     * @param vehicleDriver 司机管理
     * @return 结果
     */
    @Override
    public int updateVehicleDriver(VehicleDriver vehicleDriver)
    {
        vehicleDriver.setUpdateTime(DateUtils.getNowDate());
        return vehicleDriverMapper.updateVehicleDriver(vehicleDriver);
    }

    /**
     * 批量删除司机管理
     * 
     * @param ids 需要删除的司机管理主键
     * @return 结果
     */
    @Override
    public int deleteVehicleDriverByIds(Long[] ids)
    {
        return vehicleDriverMapper.deleteVehicleDriverByIds(ids);
    }

    /**
     * 删除司机管理信息
     * 
     * @param id 司机管理主键
     * @return 结果
     */
    @Override
    public int deleteVehicleDriverById(Long id)
    {
        return vehicleDriverMapper.deleteVehicleDriverById(id);
    }

    @Override
    public LoginDriver getDataByMobile(String mobile) {
        return vehicleDriverMapper.getDataByMobile(mobile);
    }

    @Override
    public LoginDriver register(LoginDriver loginDriver) {
        Integer loginPassengerCount = vehicleDriverMapper.register(loginDriver);
        return loginDriver;
    }
}
